<!DOCTYPE html>
<%@page contentType="text/html;charset=UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="/tld/authority.tld" prefix="authority" %>
<%@taglib uri="/tld/token.tld" prefix="token" %>
<div>
<style>
    .panel-add-to{
        padding:0 10px 20px;
    }
    .popup5 .panel-body-ws{
        padding:10px 0;
    }
    .attrVal-node-add{
        line-height:34px;
    }
    .controlX{
        width:31%;
        padding:3px;
        margin-bottom:2px;
        height:26px;
        display:inline;
    }
    .attrVal-content{
        width:376px;
        height:406px;
        overflow-y:auto;
    }
    .no-border{
        border:0;
    }
    .add-attr{
        display: block;
    }
    .add-attr .controlX{
        width:31%;
    }
    .add-attr select{
        width:30%;
        height:26px;
        padding:3px;
        margin-bottom:2px;
    }
</style>

<div class="pop-background">
    <div class="col-md-4">
        <div class="popup popup5 popup-small x-4-move">
            <div class="panel-heading">
                <div class="panel-btns">
                    <a class="panel-close btn-4-hide">×</a>
                </div>
                <h3 class="panel-title">${empty attributeParam.id or param.copy ? '新增属性内容' : '修改属性内容'}</h3>
            </div>
            <div class="panel-add-to">
                <div class="row">
                    <form>
                        <token:token/>
                        <input type="hidden" name="id" value="${param.copy?'':attributeParam.id}" />
                        <input type="hidden" name="paramData" value='${attributeParam.paramData}' />
                        <input type="hidden" name="seq" value="${attributeParam.seq}" />
                        <input type="hidden" name="categoryId" value="${attributeParam.categoryId}" />
                        <input type="hidden" name="level" value="${attributeParam.level}" />
                        <div class="panel-body panel-body-ws">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">类别：</label>

                                    <div class="col-sm-6">

                                        <c:choose>
                                            <c:when test="${empty attributeParam.id}">

                                                <div class="select-container select" style="width:39%">
                                                    <select class="select select-offscreen Lv1" name="levelOne">
                                                        <option value="">-请选择-</option>
                                                        <c:forEach items="${levelOneList}" var="item">
                                                            <option value="${item.id}" ${item.id == levelOne.id ? 'selected' : ''}>${item.name}</option>
                                                        </c:forEach>
                                                    </select>
                                                </div>

                                                <div class="select-container select" style="width:60%">
                                                    <select class="select select-offscreen Lv2" name="levelTwo">
                                                        <option value="">-请选择-</option>
                                                        <c:forEach items="${levelTwoList}" var="item">
                                                            <option value="${item.id}" ${item.id == levelTwo.id ? 'selected' : ''}>${item.name}</option>
                                                        </c:forEach>
                                                    </select>
                                                </div>

                                            </c:when>
                                            <c:otherwise>
                                                <%--
                                                <input type="hidden" name="levelOne" value="${levelOne.id}" />
                                                <input type="hidden" name="levelTwo" value="${levelTwo.id}" />
                                                <label class="control-label">${empty levelOne.name?"~":levelOne.name} / ${empty levelTwo.name?"~":levelTwo.name}</label>
                                                --%>


                                                <div class="select-container select" style="width:39%">
                                                    <select class="select select-offscreen Lv1" name="levelOne">
                                                        <option value="">-请选择-</option>
                                                        <c:forEach items="${levelOneList}" var="item">
                                                            <option value="${item.id}" ${item.id == levelOne.id ? 'selected' : ''}>${item.name}</option>
                                                        </c:forEach>
                                                    </select>
                                                </div>

                                                <div class="select-container select" style="width:60%">
                                                    <select class="select select-offscreen Lv2" name="levelTwo">
                                                        <option value="">-请选择-</option>
                                                        <c:forEach items="${levelTwoList}" var="item">
                                                            <option value="${item.id}" ${item.id == levelTwo.id ? 'selected' : ''}>${item.name}</option>
                                                        </c:forEach>
                                                    </select>
                                                </div>


                                            </c:otherwise>
                                        </c:choose>

                                    </div>
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">属性：</label>

                                    <div class="col-sm-6">
                                        <div class="select-container select">

                                            <c:choose>
                                                <c:when test="${empty attributeParam.id or param.copy}">
                                                    <select class="select select-offscreen" name="name">
                                                        <option value="">-请选择-</option>
                                                        <c:forEach items="${attributeList}" var="item">
                                                            <option value="${item.name}" ${item.name == attributeParam.name ? 'selected' : ''}>${item.name}</option>
                                                        </c:forEach>
                                                    </select>
                                                </c:when>
                                                <c:otherwise>
                                                    <input type="text" class="form-control no-border" name="name" value="${attributeParam.name}" readonly />
                                                </c:otherwise>
                                            </c:choose>

                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">属性值：</label>

                                    <div class="col-sm-6">
                                        <a class="attrVal-node-add">增加</a>
                                        <div>
                                            <input class="form-control controlX" value="内容名称" style="border:0;color:red;" disabled/>
                                            <input class="form-control controlX" value="对应编码" style="border:0;color:red;width:80px;" disabled/>
                                            <input class="form-control controlX" value="对应分类" style="border:0;color:red;width:80px;" disabled/>
                                            <input class="form-control controlX" value="排序" style="border:0;color:red;width:40px;" disabled/>
                                        </div>
                                        <div class="attrVal-content">

                                            <c:forEach items="${paramDataList}" var="item">
                                            <c:forEach items="${item.params}" var="ps" varStatus="vStatus">
                                                <div class="add-attr">
                                                    <input type="text" class="form-control controlX" name="val" value="${ps.k}" />
                                                    <input type="text" class="form-control controlX" name="identifier" value="${ps.v}" style="width:80px;"/>
                                                    <input type="text" class="form-control controlX" name="alias" value="${ps.s}" style="width:80px;"/>
                                                    <input type="text" class="form-control controlX" name="seq" value="${vStatus.count}" style="width:40px;"/>
                                                    <a class="attrVal-node-del">删除</a>
                                                </div>
                                            </c:forEach>
                                            </c:forEach>

                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </form>
                </div>

                <div class="btn-group2-s">
                    <div class="panel-body panel-body2">
                        <div class="btn-group2 left">
                            <authority:authority url="/attrParam/add,/attrParam/modify">
                                <button type="button" class="btn btn-primary btn-4-save">保存</button>
                            </authority:authority>
                            <button type="button" class="btn btn-default btn-4-hide">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="js/dictionary/attr-param-edit.js"></script>
</div>
</div>